onError

Called when an authentication error occurs.

Parameters

error

An instance of AuthenticationError containing details about the error.

Usage example:

val authErrorListener = OnAuthenticationError { error ->
when (error.data) {
is ErrorData.Jwt -> {
// Handle JWT authentication error
val errorData = error.data as ErrorData.Jwt
val jwtError = errorData.code
val message = errorData.message
// Take appropriate action based on the error code
}
}
}